/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.unal.bioingenium.kbmed.experimentation;

import co.edu.unal.bioingenium.kbmed.knowledge.weirdness.WeirdnessService;
import com.javabi.sizeof.MemoryUtil;
import gnu.trove.map.TMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntDoubleHashMap;
import gnu.trove.map.hash.TIntFloatHashMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;

/**
 *
 * @author Luis A Riveros
 */
public class MemoryAnalisys {

    public static void main(String[] args) throws IllegalAccessException {
        int size = 100000;
        double[] da = new double[size];
        float[] fa = new float[size];
        System.out.println(da.getClass().getSimpleName() + " " + MemoryUtil.sizeOf(da));
        System.out.println(fa.getClass().getSimpleName() + " " + MemoryUtil.sizeOf(fa));
        TIntDoubleHashMap tid = new TIntDoubleHashMap();
        TIntFloatHashMap tif = new TIntFloatHashMap();
        Map<Integer, Double> mid = new HashMap<Integer, Double>();
        TMap<Integer, Double> tmid = new THashMap<Integer, Double>();
        System.out.println("clean tid " + MemoryUtil.sizeOf(tid));
        System.out.println("clean tif " + MemoryUtil.sizeOf(tif));
        System.out.println("clean mid " + MemoryUtil.sizeOf(mid));
        System.out.println("clean tmid " + MemoryUtil.sizeOf(tmid));
        Random r = new Random();
        for (int i = 0; i < size; i++) {
            tid.put(i, r.nextDouble());
            tif.put(i, r.nextFloat());
            mid.put(i, r.nextDouble());
            tmid.put(i, r.nextDouble());
        }
        System.out.println("full tid " + MemoryUtil.sizeOf(tid));
        System.out.println("full tif " + MemoryUtil.sizeOf(tif));
        System.out.println("full mid " + MemoryUtil.sizeOf(mid));
        System.out.println("full tmid " + MemoryUtil.sizeOf(tmid));
        WeirdnessService weirdnessService = WeirdnessService.getInstance();
        System.out.println("weirdnessService " + MemoryUtil.sizeOf(weirdnessService));

    }
}
